home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / Mac F2C 1.2.2 / Mac F2C Documentation / Mac F2C AppleEvents / Mac F2C AppleEvents Info next >
Encoding:
Text File  |  1995-03-22  |  10.2 KB  |  245 lines  |  [TEXT/KAHL]

  1.     **************************************
  2.     **************************************
  3.  
  4.         APPLE EVENTS AND Mac F2C v1.2
  5.  
  6.     **************************************
  7.     **************************************
  8.  
  9.  
  10.  
  11. ** INTRODUCTION AND QUICK-START **
  12.  
  13. Mac F2C is Apple Event savvy.  It support drag-&-drop translation.  More 
  14. importantly, you can drive Mac F2C translations entirely using Apple 
  15. Events.  Mac F2C provides two different specialized translation events.  
  16. One (the "f2c" event) allows you to pass option choices in a UNIX-style 
  17. option string (see "UNIX f2c Option Switch Syntax" for more information on 
  18. the UNIX-style switches).  The other (the "translate" event) lets you pass 
  19. option choices just like you would in the various options dialog.  Which 
  20. you use is purely a matter of personal choice.
  21.  
  22. Two sample Apple Scripts are enclosed.  They were written using v1.1 of the 
  23. AppleScriptâ„¢ extension and v1.1 of the AppleScript Editor.  The script 
  24. "Sample Mac F2C Script 1" illustrates how to use the "f2c" event.  The 
  25. script "Sample Mac F2C Script 2" illustrates how to use the "translate" 
  26. event.  If you use AppleScript, simply modify these scripts to meet your 
  27. needs.  Mac F2C includes a full "aete" resource, so its dictionary 
  28. provides detailed information on the exact syntax of the Apple Events 
  29. supported by Mac F2C.
  30.  
  31. The remainder of this document provides more detailed information for users 
  32. who wish to know more about the Mac F2C Apple Events.  In particular, the 
  33. information below has all the information needed to write code that sends 
  34. Apple Events to Mac F2C.
  35.  
  36.  
  37. ** CHANGES FROM Mac F2C v1.1 **
  38.  
  39. The "translate" AppleEvent now accepts a list of FORTRAN files to translate 
  40. into C (vice a single file).  It now returns a list of integers (vice a 
  41. single integer), each integer being the return code from the 
  42. f2c kernel for the corresponding FORTRAN file.
  43.  
  44.  
  45.  
  46.  
  47. *******  Mac F2C APPLE EVENTS: THE DETAILS  *******
  48.  
  49.  
  50. REQUIRED APPLE EVENTS
  51.  
  52. Mac F2C supports the four required Apple Events: open application, open 
  53. documents, print documents, and quit application.  These events behave as 
  54. follows:
  55.  
  56.     - open application:     No unique actions are performed.
  57.     
  58.     - open documents:       Documents listed are translated into C using the 
  59.                             default options settings.  An error message is 
  60.                             issued if the document name does not end in ".f" or 
  61.                             ".F".  An open event is equivalent to a "translate" 
  62.                             event (see below) with no optional parameters. 
  63.                         
  64.     - print documents:      Silently ignored; Mac F2C does not print any 
  65.                             documents.  Printing of the translation status 
  66.                             window via AppleEvents is not yet supported. 
  67.     
  68.     - quit application:     Quits Mac F2C.
  69.     
  70. Note that Mac F2C does not own any files (i.e., there are no files of type 
  71. Mac F2C except for the application itself).  The open event is used to 
  72. support drag-&-drop operation.  This allows you to translate a bunch of 
  73. FORTRAN files by dragging them and dropping them on top of Mac F2C.
  74.  
  75.  
  76. THE Mac F2C SUITE
  77.  
  78. The Mac F2C Suite is a set of Apple events that can be used to control the 
  79. translation of FORTRAN files to C files.  The Mac F2C suite consists of two 
  80. events differing in how options are passed to the f2c kernel.  The first 
  81. event mimics the operation of the original f2c program on UNIX machines.  
  82. In this event options for the f2c kernel are passed as a single string of 
  83. UNIX-style option settings.  The second event mimics the operation of Mac 
  84. F2C.  In this event options for the f2c kernel are passed by specifying the 
  85. values of the check-boxes, radio-buttons, and edit-fields found in the 
  86. various Mac F2C option dialogs.
  87.  
  88. These two events are:
  89.  
  90. Name                Requested Action
  91. ----                ----------------
  92. f2c                 Translate the specified files (one or more) from 
  93.                     FORTRAN to C using a UNIX-style string of options.
  94.                     
  95. translate           Translate the specified files (one or more) from 
  96.                     FORTRAN to C selecting options by setting choices 
  97.                     in the options dialogs.
  98.  
  99. More detailed event descriptions follow:
  100.  
  101.  
  102.  
  103. f2c 
  104. ~~~ 
  105.  
  106. This event causes Mac F2C translate one or more FORTRAN files.  The 
  107. options for the f2c kernel are specified by a UNIX-style set of switches 
  108. (e.g.  "-A -P -w -f"; see "UNIX f2c Option Switch Syntax" for more 
  109. information on the switches and their meaning).
  110.  
  111. Event Class:            kF2CEventClass
  112.  
  113. Event ID:               kAEf2cEvent
  114.  
  115. Parameters:
  116.  
  117.   keyDirectObject       typeAEList (elements    the list of FORTRAN files 
  118.                         are typeAlias)          to translate
  119.  
  120.   keyUnixCmdStr         typeChar                a UNIX-style option string      
  121.                 
  122.   keyCreatorOption      typeType                the creator OSType for output 
  123.                                                 files
  124.  
  125.   keyThinkOption        typeBoolean             touch the corresponding THINK 
  126.                                                 project file?
  127.  
  128.   keyCWOption           typeBoolean             touch the corresponding 
  129.                                                 CodeWarrior project file?
  130.  
  131.   keyMakeOption         typeBoolean             send THINK/CodeWarrior a
  132.                                                 make command after 
  133.                                                 translation?
  134.  
  135. Reply Parameters:
  136.  
  137.   keyAEResult           typeAEList (elements    the return code from the f2c 
  138.                         are typeInteger         kernel, one per file translated
  139.  
  140.   keyErrorNumber        typeLongInteger         error code if Mac F2C was unable 
  141.                                                 to _process_ your event; not 
  142.                                                 provided if no _processing_ 
  143.                                                 errors occur.  Compile results 
  144.                                                 (including compile errors) are 
  145.                                                 returned in keyAEResult
  146.                                                 
  147.   keyErrorString        typeChar                an error message whenever 
  148.                                                 keyErrorNumber is non-zero
  149.  
  150.  
  151.  
  152. translate 
  153. ~~~~~~~~~ 
  154.  
  155. This event will have Mac F2C translate one FORTRAN file.  The options for 
  156. the f2c kernel are specified by lists of settings corresponding to each of 
  157. the options dialogs in Mac F2C.  Radio-buttons and check-boxes are set by 
  158. boolean values (true means selected or checked, false means unselected or 
  159. unchecked).  Edit-fields are set by short integer values.
  160.  
  161. Event Class:            kF2CEventClass
  162.  
  163. Event ID:               kAETranslateEvent
  164.  
  165. Parameters:
  166.  
  167.   keyDirectObject       typeAEList (elements    the list of FORTRAN files 
  168.                         are typeAlias)          to translate
  169.  
  170.   keyFortranOptions     typeAEList (elements    the settings of the FORTRAN 
  171.                         are typeBoolean)        Options dialog check-boxes
  172.  
  173.   keyCOptions           typeAEList (elements    the settings of the C Options
  174.                         are typeBoolean)        dialog radio-buttons and 
  175.                                                 check-boxes
  176.  
  177.   keyProtoOptions       typeAEList (elements    the settings of the Prototyping 
  178.                         are typeBoolean)        Options dialog check-boxes
  179.  
  180.   keyWarnOptions        typeAEList (elements    the settings of the Warning 
  181.                         are typeBoolean)        Options dialog check-boxes
  182.  
  183.   keyAdvancedOptions    typeAEList (elements    the numbers in the Advanced 
  184.                         are typeShortInteger)   Options edit-text fields
  185.  
  186.   keyUnixOptions        typeChar                a UNIX-style option string to 
  187.                                                 be appended after all other 
  188.                                                 options                                                                                                             are processed
  189.  
  190.   keyCreatorOption      typeType                the creator OSType for output 
  191.                                                 files
  192.  
  193.   keyThinkOption        typeBoolean             touch the corresponding 
  194.                                                 THINK project file?
  195.  
  196.   keyCWOption           typeBoolean             touch the corresponding 
  197.                                                 CodeWarrior project file?
  198.  
  199.   keyMakeOption         typeBoolean             send THINK/CodeWarrior a 
  200.                                                 "make" command after 
  201.                                                 translation?
  202.  
  203. Reply Parameters:
  204.  
  205.   keyAEResult           typeAEList (elements    the return code from the f2c 
  206.                         are typeInteger         kernel, one per file translated
  207.  
  208.   keyErrorNumber        typeLongInteger         error code if Mac F2C was unable 
  209.                                                 to _process_ your event; not 
  210.                                                 provided if no _processing_ 
  211.                                                 errors occur.  Compile results 
  212.                                                 (including compile errors) are 
  213.                                                 returned in keyAEResult
  214.  
  215.   keyErrorString        typeChar                an error message whenever
  216.                                                 keyErrorNumber is non-zero
  217.  
  218.  
  219.  
  220. Mac F2C Constants
  221. ~~~~~~~~~~~~~~~~~
  222.  
  223. The following constants are used by the Mac F2C suite.  They also appear in 
  224. the file "MacF2C_AEConstants.h".
  225.  
  226.             kF2CEventClass              'F2Ci'
  227.  
  228.             kAETranslateEvent           'F2C1'
  229.             kAEf2cEvent                 'F2C2'
  230.  
  231.             keyFortranOptions           'F2Cf'      
  232.             keyCOptions                 'F2Cc'      
  233.             keyProtoOptions             'F2Cp'      
  234.             keyWarnOptions              'F2Cw'      
  235.             keyAdvancedOptions          'F2Cn'  
  236.             keyUnixOptions              'F2Cu'  
  237.             keyUnixCmdStr               'F2Cs'  
  238.             keyCreatorOption            'F2Ct'  
  239.             keyThinkOption              'F2CT'
  240.             keyCWOption                 'F2CC'  
  241.             keyMakeOption               'F2Cr'  
  242.  
  243.  
  244.  
  245.